<?php

declare(strict_types=1);

namespace app\common\service;

use Ip2Region;

class IpService extends Ip2Region
{

    /**
     * 直接查询并返回Json
     * @param string $ip
     * @return string
     * @throws \Exception
     */
    public function simpleJson($ip)
    {
        $geo = $this->memorySearch($ip);
        $arr = explode('|', str_replace(['0|'], '|', isset($geo['region']) ? $geo['region'] : ''));
        return $arr;
    }
}
